<!DOCTYPE html>
<html lang="en">

<!--****头部 star****-->
@include('Admin.Public.header')
<body>
<div class="wrapper">

    <!--****主要头部 star****-->
@include('Admin.Public.main_header')

<!--****菜单栏 star****-->
@include('Admin.Public.menus')

<!--****内容页 star****-->
    <div style="width:100%;height:100%;-webkit-overflow-scrolling:touch;overflow-y: hidden;"> 
        <iframe id="content-page" width="100%" height="100%"  frameborder="0" src="/myadmin/panle"></iframe>
    </div>

    <!--****菜单栏 star****-->
{{--	@include('Admin.Public.custom_template')--}}

<!-- 修改密码 -->
    <div class="modal fade" id="change_password_box" tabindex="-1" role="dialog" aria-labelledby="exampleModalCenterTitle"
         aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="exampleModalLongTitle">修改密码</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <form id="change_password">
                        <div class="form-group">
                            <label for="exampleInputEmail1">旧密码</label>
                            <input type="password" class="form-control" id="old_pwd" name="old_pwd" placeholder="" max="100"
                                   data-required="true">
                        </div>
                        <div class="form-group">
                            <label for="exampleInputEmail1">新密码</label>
                            <input type="password" class="form-control" id="pwd" placeholder="" max="100"
                                   data-required="true">
                        </div>
                        <div class="form-group">
                            <label for="exampleInputEmail1">重复密码</label>
                            <input type="password" class="form-control" id="new_pwd" name="new_pwd" placeholder="" max="100"
                                   data-required="true">
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
                    <button type="button" class="btn btn-primary" onclick="changePassword()"> Save</button>
                </div>
            </div>
        </div>
    </div>

</div>
<!--****菜单栏 star****-->
@include('Admin.Public.footer')
<!-- Azzara DEMO methods, don't include it in your project! -->
{{--<script src="/static/Admin/js/setting-demo.js"></script>--}}
<script src="/static/Admin/js/index.js"></script>
<script>
    function changePassword() {
        var pwd = $('#pwd').val();
        var new_pwd = $('#new_pwd').val();
        if (pwd != new_pwd) {
            swal("错误!", '两次密码不一致', {
                icon : "error",
                buttons: {
                    confirm: {
                        className : 'btn btn-danger'
                    }
                },
            });
            return;
        }

        var data = $('#change_password').serialize();
        $.requestAjax({
            type: "post",
            url: "/myadmin/admin/change_password",
            data: data,
            dataType: "json",
            headers: {
                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
            },
            success: function (e) {
                swal("成功!", e.msg, {
                    icon : "success",
                    buttons: {
                        confirm: {
                            className : 'btn btn-success'
                        }
                    },
                }).then(function() {
                    window.history.go(0)
                });
            },
            error: function (e) {

            }
        });
    }
</script>
</body>
</html>